package Common.Entities;

import java.io.Serializable;
import java.util.ArrayList;

import Common.Entities.*;

/**
 * This class is for holding the information of the salesmen and customers who are not yet been assigned
 * @author Oz Mouchtar
 *
 */
public class SalesmenAndCustomersForSale implements Serializable {
	
	private static final long serialVersionUID = 1L;
	private Sale sale;
	private String salesmanID;
	private String salesmanName;
	private ArrayList<String[]> salesmen;
	private ArrayList<String[]> customers;
	private SalesTaskForce toAssigne;
	private final int maxCustomers;
	
	/**
	 * @param sale
	 * @param salesmen
	 * @param customers
	 */
	public SalesmenAndCustomersForSale(Sale sale, ArrayList<String[]> salesmen,
			ArrayList<String[]> customers) {
		this.sale = sale;
		this.salesmanID = salesmanID;
		this.salesmanName = salesmanName;
		this.salesmen = salesmen;
		this.customers = customers;
		this.toAssigne = new SalesTaskForce();
		this.maxCustomers = customers.size()/salesmen.size();

	}
	/**
	 * @return the saleID
	 */
	public Sale getSale() {
		return sale;
	}
	/**
	 * @param sale the sale to set
	 */
	public void setSale(Sale sale) {
		this.sale = sale;
	}
	/**
	 * @return the salesmanID
	 */
	public String getSalesmanID() {
		return salesmanID;
	}
	/**
	 * @param salesmanID the salesmanID to set
	 */
	public void setSalesmanID(String salesmanID) {
		this.salesmanID = salesmanID;
	}
	/**
	 * @return the salesmanName
	 */
	public String getSalesmanName() {
		return salesmanName;
	}
	/**
	 * @param salesmanName the salesmanName to set
	 */
	public void setSalesmanName(String salesmanName) {
		this.salesmanName = salesmanName;
	}
	/**
	 * @return the salesmen
	 */
	public ArrayList<String[]> getSalesmen() {
		return salesmen;
	}
	/**
	 * @param salesmen the salesmen to set
	 */
	public void setSalesmen(ArrayList<String[]> salesmen) {
		this.salesmen = salesmen;
	}
	/**
	 * @return the customers
	 */
	public ArrayList<String[]> getCustomers() {
		return customers;
	}
	/**
	 * @param customers the customers to set
	 */
	public void setCustomers(ArrayList<String[]> customers) {
		this.customers = customers;
	}
	
	public void deleteFromSalesmenList(String[] toDelete){
		for(int i = 0 ; i < salesmen.size() ; i++){
			if(salesmen.get(i).equals(toDelete))
				salesmen.remove(i);
				
		}
			
	}
	public void deleteFromCustomers(String[] toDelete){
		for(int i = 0 ; i < customers.size() ; i++){
			if(customers.get(i).equals(toDelete))
				customers.remove(i);
		}
	}
	/**
	 * @return the toAssigne
	 */
	public SalesTaskForce getToAssigne() {
		return toAssigne;
	}
	/**
	 * @param toAssigne the toAssigne to set
	 */
	public void setToAssigne(SalesTaskForce toAssigne) {
		this.toAssigne = toAssigne;
	}
	
	public void addToTaskForce(SalesmenCustomerLists salesmanList){
		this.toAssigne.addSalesManCustomerList(salesmanList);
	}
	/**
	 * @return the maxCustomers
	 */
	public int getMaxCustomers() {
		return maxCustomers;
	}
	

}
